package coding.datastructures;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class PermutaitonTwoStrings {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		permutation();
	}

	public static void permutation() {
		String str1 = "12345";
		String str2 = "53214";
		String str3 = "15326";
		ArrayList char_str1 = (ArrayList) splitString(str1);
		Collections.sort(char_str1);
		ArrayList char_str2 = (ArrayList) splitString(str2);
		Collections.sort(char_str2);
		ArrayList char_str3 = (ArrayList) splitString(str3);
		Collections.sort(char_str3);
		if(char_str1.equals(char_str2)){
			System.out.println("equal");
		}
		if(!char_str1.equals(char_str3)){
			System.out.println("not equal");
		}
	}

	public static List splitString(String str) {
		List char_str1 = new ArrayList();
		for (int i = 0; i < str.length(); i++) {
			char_str1.add(str.charAt(i));
		}
		return char_str1;
	}

}
